package com.mydemo.design_pattern.action_type.observer_pattern.impl;

import com.mydemo.design_pattern.action_type.observer_pattern.Observer;
import com.mydemo.design_pattern.action_type.observer_pattern.Subject;

/**
 * <p></p >
 *
 * @author liming1
 * @version $Id: HexaObserver, v1.0 2019-09-23 15:09 liming1 Exp $
 */
public class HexaObserver extends Observer {

    public HexaObserver(Subject subject){
        this.subject = subject;
        this.subject.addObserver(this);
    }

    @Override
    public void update() {
        System.out.println( "Hex String: "
                + Integer.toHexString( subject.getState() ).toUpperCase() );
    }
}
